import React from 'react'
import './styles/nav.css'
import { useNavigate } from 'react-router-dom'



const option = [
    {name:'登录',url:'/login'},
    {name:'注册',url:'/register'},
    {name:'订单',url:'/order'},
    {name:'购物车',url:'/cart'}
]
const menu = [
    {name:'首页',url:'/'},
    {name:'蛋糕名录',url:'/cakes'},
    {name:'企业专区',url:'/ltd'},
    {name:'关于我们',url:'/about'},
    {name:'测试',url:'/test'}
]

// const ltd_item = [
//     {
//       key: 'free',
//       label: "免费试吃",
//     },
//     {
//       key: 'customized',
//       label:"定制"
//     },
//     {
//       key:"bigOrder",
//       label:"大宗购买"
//     }
//   ];


function TopNavict(){
    const navigate = useNavigate();
    const jumpOption = (url) => {
       navigate(url);
    };
    return (
        <div className="topNavict">
            <div className='top'>
                <div className='space-occupying'></div>
                <div className='option'>
                    {option.map((item,index)=>(
                        <div key={index}>
                            <div className='btn-text' onClick={()=>jumpOption(item.url)}>{item.name}</div>
                        </div>
                    ))}
                </div>
            </div>
            <div className='item'>
                <div className='left'>
                    <div className='img'>
                        <img className='img-t' src="https://jimucake.com/views/default/skin/default/images/pic/logo.png" alt="" />
                    </div>
                    <div className='logo'>
                        <span className='logo-txt'>武汉</span>
                    </div>
                </div>
                <div className='menu'>
                    {menu.map((item,index)=>(
                        <div key={index} onClick={()=>jumpOption(item.url)}>
                            <div className='menu-text'>{item.name}</div>
                        </div>
                    ))}
                </div>
            </div>
            
        </div>
    )
}

export default TopNavict